package com.kmxd.ams.infra.search.entity;

import cn.easyes.annotation.HighLight;
import cn.easyes.annotation.IndexField;
import cn.easyes.annotation.rely.FieldType;
import cn.easyes.annotation.rely.HighLightTypeEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.kmxd.ams.client.search.vo.SearchAuthVO;
import com.kmxd.ams.core.common.constant.Constants;
import com.kmxd.ams.infra.arrange.entity.Document;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * 文档es对象
 *
 * @author nickbi
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class DocumentEs extends Document {

  /** 门类名称 */
  private String archTypeName;

  /** 门类类型 */
  private String archModel;

  private String archModelName;

  /** 知悉范围划分：按本部门 */
  private Boolean authDepartment;

  /** 知悉范围划分：按创建人 */
  private Boolean authUser;

  // 知悉范围内
  /** 在线浏览 */
  private Boolean onlineBrowser;

  /** 在线打印 */
  private Boolean onlinePrint;

  /** 下载 */
  private Boolean download;

  /** 下载源文件 */
  private Boolean downloadSource;

  /** 现场借阅 */
  private Boolean liveRead;

  /** 外借 */
  private Boolean lendOut;

  /** 复制外发 */
  private Boolean copySend;

  /** 摘录 */
  private Boolean excerpt;

  /** 知悉范围外 */
  /** 在线浏览 */
  private Boolean outOnlineBrowser;

  /** 在线打印 */
  private Boolean outOnlinePrint;

  /** 下载 */
  private Boolean outDownload;

  /** 下载源文件 */
  private Boolean outDownloadSource;

  /** 现场借阅 */
  private Boolean outLiveRead;

  /** 外借 */
  private Boolean outLendOut;

  /** 复制外发 */
  private Boolean outCopySend;

  /** 摘录 */
  private Boolean outExcerpt;

  /** 通用利用权限 */
  /** 在线浏览 */
  private Boolean otherOnlineBrowser;

  /** 在线打印 */
  private Boolean otherOnlinePrint;

  /** 下载 */
  private Boolean otherDownload;

  /** 下载源文件 */
  private Boolean otherDownloadSource;

  /** 现场借阅 */
  private Boolean otherLiveRead;

  /** 外借 */
  private Boolean otherLendOut;

  /** 复制外发 */
  private Boolean otherCopySend;

  /** 摘录 */
  private Boolean otherExcerpt;

  /** 公司id */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long comId;

  /** 年度高亮字段 */
  private String yearHl;

  /** 部门高亮 */
  private String departmentHl;
  /** 档号高亮 */
  private String archCodeHl;

  /** 文件形态高亮 */
  private String fileTypeHl;
  /** 标题高亮 */
  private String titleHl;

  /** 检索拼接字段 */
  private String amsContent;

  /** 电子文件原文拼接内容 */
  private String amsFileContent;

  /** 电子文件拼接标题 */
  private String amsFileTitle;
  /** 收藏标志 */
  private Boolean collectFlag;
  /** 借阅车标志 */
  private Boolean borrowCarFlag;

  private SearchAuthVO auth;

  @IndexField(fieldType = FieldType.NESTED, nestedClass = EFileRecordEs.class)
  private List<EFileRecordEs> records;

  /** 档号 */
  @HighLight(
      mappingField = "archCodeHl",
      preTag = Constants.ES_HIGHLIGHT_PRE_TAG,
      postTag = Constants.ES_HIGHLIGHT_POST_TAG)
  @IndexField(fieldType = FieldType.KEYWORD)
  private String archCodeKw;

  /** 题名 */
  @HighLight(
      mappingField = "titleHl",
      highLightType = HighLightTypeEnum.PLAIN,
      preTag = Constants.ES_HIGHLIGHT_PRE_TAG,
      postTag = Constants.ES_HIGHLIGHT_POST_TAG)
  @IndexField(fieldType = FieldType.KEYWORD)
  private String titleKw;

  private Boolean browserFile;
  private Boolean outBrowserFile;
  private Boolean otherBrowserFile;

  /** 件号，数值类型 */
  private Long docSequenceNum;
  /** 单位名称 */
  private String comName;
}
